package cn.huermao.hio.other;

import java.nio.ByteBuffer;

/**
 * @author 胡二毛
 */
public class HioUtils {
    //缓冲流转字符串
    public static String byteBufferToString(ByteBuffer byteBuffer) {
//        String s = new String(byteBuffer.array(), HioContext.CHARSET);
//        if (byteBuffer == null) {
//            return null;
//        }
//        CharBuffer charBuffer = HioContext.CHARSET.decode(byteBuffer);
//        return charBuffer.toString();
        return null;
    }

    // 深度拷贝方法
    public static ByteBuffer clone(ByteBuffer original) {
        ByteBuffer clone = ByteBuffer.allocate(original.remaining());
        clone.put(original);
        clone.flip();
        return clone;
    }
}
